<?php

class DefaultController extends Controller
{
    private function filterClient() {
        $user = Yii::app()->getModule('user')->user();
        if(!$user || $user->profile->userType != 0) {
            throw new CHttpException(403, "You're not a client");
        } 
    }
    
    
	public function actionIndex()
	{
	    $this->filterClient();
	    
	    $doctors = Profile::getDoctorIdNameArray();
	    $clinics = Clinic::getAllForDropdown();
		
		$this->render('index', array(
            'doctors' => $doctors,
	        'clinics' => $clinics,
        ));
	}
}